from concurrent.futures import ThreadPoolExecutor

import requests
from DrissionPage._base.chromium import Chromium
from DrissionPage._configs.chromium_options import ChromiumOptions


co = ChromiumOptions()
# co = ChromiumOptions().headless()
# co.set_browser_path(r'/opt/google/chrome/google-chrome')
# co.set_argument('--no-sandbox')
# 设置启动时最大化
co.set_argument('--start-maximized')
# 无痕
# co.set_argument('--incognito')
# 连接浏览器
browser = Chromium(co)

tab = browser.latest_tab

tab.get('https://jncc.jinan.gov.cn/jnfdcinfo/jnfdcweb/onsaling/index_1.shtml?zn=all&pu=all&pn=&en=')



allcounts = tab.ele('#allcounts').value
allpage = tab.ele('#allpage').value

print(allcounts)
print(allpage)
# for page in range(int(allpage)):
#     tab.get(
#         f'https://jncc.jinan.gov.cn/jnfdcinfo/jnfdcweb/onsaling/index_{page + 1}.shtml?zn=all&pu=all&pn=&en=')
#     links = tab.ele('.form-list').s_eles('t:a')
#     print(len(links))
#     for lnk in links:
#         if lnk.link.startswith('https'):
#             print(lnk.link)